package com.fulihui.wgj.facade.service.wx48;

import com.fulihui.common.error.InvokeServiceException;
import com.fulihui.common.request.rpc.AppRequest;
import com.fulihui.common.result.rpc.BaseResult;
import com.fulihui.common.result.rpc.SimpleResult;
import com.fulihui.wgj.facade.dto.Wx48NewsInfoDTO;
import com.fulihui.wgj.facade.dto.Wx48NewsLogDTO;
import com.fulihui.wgj.facade.request.wx48.Wx48AttentionSaveRequest;
import com.fulihui.wgj.facade.request.wx48.Wx48NewsCrowdRequest;
import com.fulihui.wgj.facade.request.wx48.Wx48NewsInfoPageQueryRequest;
import com.fulihui.wgj.facade.request.wx48.Wx48NewsInfoSaveRequest;
import com.fulihui.wgj.facade.request.wx48.Wx48NewsLogCancelRequest;
import com.fulihui.wgj.facade.request.wx48.Wx48NewsLogPageQueryRequest;
import com.fulihui.wgj.facade.request.wx48.Wx48NewsLogQueryRequest;
import com.fulihui.wgj.facade.request.wx48.Wx48NewsLogSaveRequest;
import com.fulihui.wgj.facade.request.wx48.Wx48NewsLogUpdateAccumRequest;
import com.fulihui.wgj.facade.request.wx48.Wx48NewsLogUpdateRequest;
import com.fulihui.wgj.facade.request.wx48.Wx48NewsSendRequest;
import com.fulihui.wgj.facade.result.wx48.Wx48NewsInfoPageResult;
import com.fulihui.wgj.facade.result.wx48.Wx48NewsLogPageResult;

import java.util.Date;
import java.util.List;

/**
 * 48小时回复Service
 *
 * @author wang_wx
 * @date 2018-07-06
 */
public interface Wx48NewsInfoService {

    /**
     * 保存48小时互动用户
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    BaseResult saveAttention(Wx48AttentionSaveRequest request) throws InvokeServiceException;

    /**
     * 删除48小时互动用户-超过时间
     *
     * @param exceedTime 超出时间
     * @return 返回删除记录条数
     */
    SimpleResult<String> deleteByLessModified(Date exceedTime);

    /**
     * 查询特定48小时回复
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    SimpleResult<Wx48NewsInfoDTO> querySpecificReply(AppRequest request) throws InvokeServiceException;

    /**
     * 分页查询48小时图文消息
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    Wx48NewsInfoPageResult pageQueryNewsInfo(Wx48NewsInfoPageQueryRequest request) throws InvokeServiceException;

    /**
     * 保存48小时图文消息
     *
     * @param request 包含id为更新操作
     * @return
     * @throws InvokeServiceException
     */
    SimpleResult<Long> saveNewsInfo(Wx48NewsInfoSaveRequest request) throws InvokeServiceException;

    /**
     * 微信48小时发送-计算人数
     *
     * @param request 条件
     * @return 计算人数
     * @throws InvokeServiceException
     */
    SimpleResult<String> countSendWx48News(Wx48NewsCrowdRequest request) throws InvokeServiceException;

    /**
     * 微信48小时发送
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    BaseResult sendWx48News(Wx48NewsLogSaveRequest request) throws InvokeServiceException;

    /**
     * 微信48小时发送-用于定时调用
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    BaseResult sendWx48NewsTask(Wx48NewsSendRequest request) throws InvokeServiceException;

    /**
     * 分页查询48小时发送记录
     *
     * @param request
     * @return
     */
    Wx48NewsLogPageResult pageQueryNewsLog(Wx48NewsLogPageQueryRequest request) throws InvokeServiceException;

    /**
     * 查询48小时发送记录-不分页
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    SimpleResult<List<Wx48NewsLogDTO>> queryNewsLog(Wx48NewsLogQueryRequest request) throws InvokeServiceException;

    /**
     * 更新发送批次记录
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    BaseResult updateNewsLog(Wx48NewsLogUpdateRequest request) throws InvokeServiceException;

    /**
     * 取消发送48小时小时-定时的
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    BaseResult cancelNewsLog(Wx48NewsLogCancelRequest request) throws InvokeServiceException;

    /**
     * 更新发送批次记录 用于更改状态、成功数、失败数等--累加原来的数字
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    BaseResult updateNewsLogAccumulate(Wx48NewsLogUpdateAccumRequest request) throws InvokeServiceException;
}
